﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;

namespace Vallejos.Datos.Servicios
{
    public class DatabaseService : IDataBase
    {
        #region IDataBase Members

        private readonly Database _database = null;

        public DatabaseService(Database database)
        {
            _database = database;
        }

        public DbCommand GetStoredProcCommand(string storedProcedureName)
        {

            return _database.GetStoredProcCommand(storedProcedureName);
        }

        public void AddInParameter(DbCommand command, string name, DbType dbType, object value)
        {
            _database.AddInParameter(command, name, dbType, value);
        }

        public IDataReader ExecuteReader(DbCommand command)
        {
            return _database.ExecuteReader(command);
        }

        public void AddOutParameter(DbCommand command, string name, DbType dbType, int size)
        {
            _database.AddOutParameter(command, name, dbType, size);
        }

        public object GetParameterValue(DbCommand command, string name)
        {
            return _database.GetParameterValue(command, name);
        }

        public void ExecuteNonQuery(DbCommand command)
        {
            _database.ExecuteNonQuery(command);
        }

        public void SetParameterValue(DbCommand command, string parameterNname, object value)
        {
            _database.SetParameterValue(command, parameterNname, value);
        }

        #endregion
    }
}
